<!DOCTYPE html>
<html lang="en">
<head>
  <meta charset="UTF-8">
  <meta name="viewport" content="width=device-width, initial-scale=1.0">
  <title>Document</title>
  <style>
    button.active{
      background: red;
    }
    .box{
      width:150px;
      height: 150px;
      border:1px solid #333;
    }
  </style>
</head>
<body>
  <div id="app">
    <button 
      v-for="(item,index) in arr"
      @click="changeTab(index)" :class="{active:num==index}">
      {{ item }}
    </button>
    <div class="box"
      v-for="(item,index) in arr"
      v-show="num==index">{{item}}</div>
    
  </div>
  <script src="./vue.js"></script>
  <script>
    const vm = new Vue({
      el: '#app',
      data: {
        num: 0,
        arr: [1,2,3,4]
      },
      methods: {
        changeTab (n) {
          this.num = n;
        }
      }
    })
  </script>
</body>
</html>